Validating LR(1) Parsers
نویسندگان
چکیده
An LR(1) parser is a finite-state automaton, equipped with a stack, which uses a combination of its current state and one lookahead symbol in order to determine which action to perform next. We present a validator which, when applied to a context-free grammar G and an automaton A, checks that A and G agree. Validating the parser provides the correctness guarantees required by verified compilers and other high-assurance software that involves parsing. The validation process is independent of which technique was used to construct A. The validator is implemented and proved correct using the Coq proof assistant. As an application, we build a formally-verified parser for the C99 language.
منابع مشابه
A Case Study in Functional Programming: Generating Eecient Functional Lr(1) Parsers
This paper presents a case study in functional programming. The paper is based upon a chapter of the course notes of a grammars and parsing course which the authors have given to undergraduate students. The chapter presents a functional program that generates eecient functional LR(1) parsers.
متن کاملError Recovery in LR Parsers
This report presents a survey of four syntax error recovery techniques for LR Parsers. The techniques presented are described in [Modry 78, Graham 79, Sippu 83, Mckenzie 95, Bertsch 99]. After an introduction to general syntactic error recovery techniques in LR parsers, I would present a brief overview and comparison of these techniques in this report.
متن کاملFaster Generalized LR Parsing
Tomita devised a method of generalized LR (GLR) parsing to parse ambiguous grammars e ciently. A GLR parser uses linear-time LR parsing techniques as long as possible, falling back on more expensive general techniques when necessary. Much research has addressed speeding up LR parsers. However, we argue that this previous work is not transferable to GLR parsers. Instead, we speed up LR parsers b...
متن کاملCleaned SLL(1) Grammars are SLR(1)
We establish the following specific relation between contextfree grammars that have LL(k) and LR(k) parsers, respectively: after cleaning an SLL(1) grammar (by unfolding its empty productions), the resulting grammar is SLR(1).
متن کاملNon-deterministic Recursive Ascent Parsing
A purely functional implementation of LR-parsers is given, together with a simple correctness proof. It is presented as a generalization of the recursive descent parser. For non-LR grammars the time-complexity of our parser is cubic if the functions that constitute the parser are implemented as memo-functions, i.e. functions that memorize the results of previous invocations. Memo-functions also...
متن کامل